#include <iostream>
#include <vector>
#include <list>
#include "geometry.h"
#include "left_turn.h"

int main()
{
   int n;
   std::cin >> n;
   std::vector<point> points;
   for (int i = 0; i < n; i++)
   {
      double x, y;
      std::cin >> x >> y;
      points.push_back(point(x, y));
   }
   
   if (n == 0)
   {
     std::cout << 0;
     return 0;
   }

   if (n == 1)
   {
      std::cout << 1 << "\n";
      std::cout.precision(20);
      std::cout << points[0].x << " " << points[0].y << "\n";
      return 0;
   }
 
   point_sort(points);

   std::vector<point> q;
   q.push_back(points[0]);
   q.push_back(points[1]);
   for (int i = 2; i < n; i++)
   {
      while (q.size() > 1 && left_turn(q[q.size() - 2], q[q.size() - 1], points[i]) <= 0)
      {
         q.pop_back();
      }
      q.push_back(points[i]);
   }
   if (q[0] == q[1])
   {
      q.pop_back();
   }
   std::cout << q.size() << "\n";
   std::cout.precision(20);
   for (unsigned int i = 0; i < q.size(); i++) 
   {
      std::cout << q[i].x << " " << q[i].y << "\n";
   }
   return 0;
}